﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanmia.Core;
using FluentNHibernate.Mapping;

namespace Tanmia.NHibernate.Mapping
{
    public class PaymentMap : ClassMap<Payment>
    {
        public PaymentMap()
        {
            Table("Payment");

            Id(x => x.PaymentID).Not.Nullable().GeneratedBy.Identity();

            Map(x => x.PaymentType).Not.Nullable().CustomType<PaymentTypeEnum>();
            Map(x => x.Value).Not.Nullable().Default("0");
            Map(x => x.CreateDate).Not.Nullable().Not.Update();
            Map(x => x.Note).Nullable().Length(2048);

            References(x => x.User, "UserID").Not.Nullable();
            References(x => x.Person, "PersonID").Not.Nullable();
        }
    }
}
